<?php


/**
 * This functions retrieves a news list from  It uses the Cache services to speed up the process.
 */
function osc_listNews() {
    require_once LIB_PATH . 'osclass/classes/Cache.php';

    $cache = new Cache('admin-blog_news', 900);
    if ($cache->check()) {
        return $cache->retrieve();
    } else {
        $list = array();

        $content = osc_file_get_contents('');
        if ($content) {
            $xml = simplexml_load_string($content);
            foreach ($xml->channel->item as $item) {
                $list[] = array(
                    'link' => strval($item->link)
                    , 'title' => strval($item->title)
                    , 'pubDate' => strval($item->pubDate));
            }
        }

        $cache->store($list);
    }

    return $list;
}

?>